<template>
  <div class="appointment-container">
    <!-- 员工选择 -->
    <div class="section-card">
      <div class="section-header">
        <div class="section-title">选择美容师</div>
        <div class="section-divider"></div>
      </div>
      <div class="staff-list">
        <div 
          v-for="staff in staffList" 
          :key="staff.id"
          :class="['staff-item', { active: selectedStaff === staff.id }]"
          @click="selectStaff(staff.id)"
        >
          <img :src="staff.avatar" :alt="staff.name" class="staff-avatar">
          <div class="staff-info">
            <div class="staff-name">{{ staff.name }}</div>
            <div class="staff-position">{{ staff.position }}</div>
          </div>
        </div>
      </div>
    </div>

    <!-- 时长选择 -->
    <div class="section-card">
      <div class="section-header">
        <div class="section-title">服务时长</div>
        <div class="section-divider"></div>
      </div>
      <el-select v-model="selectedDuration" placeholder="请选择时长" class="duration-select">
        <el-option
          v-for="item in durationOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
    </div>

    <!-- 日期选择 -->
    <div class="section-card">
      <div class="section-header">
        <div class="section-title">选择日期</div>
        <div class="section-divider"></div>
      </div>
      <div class="date-list">
        <div 
          v-for="date in dateList" 
          :key="date.value"
          :class="['date-item', { active: selectedDate === date.value }]"
          @click="selectDate(date.value)"
        >
          <div class="date-week">{{ date.week }}</div>
          <div class="date-day">{{ date.day }}</div>
        </div>
      </div>
    </div>

    <!-- 时间段选择 -->
    <div class="section-card">
      <div class="section-header">
        <div class="section-title">选择时间</div>
        <div class="section-divider"></div>
      </div>
      <div class="time-list">
        <div 
          v-for="time in timeSlots" 
          :key="time.value"
          :class="[
            'time-item', 
            { 
              active: isTimeSelected(time.value),
              disabled: time.disabled,
              'time-range': isTimeInRange(time.value)
            }
          ]"
          @click="selectTime(time.value)"
        >
          {{ time.label }}
        </div>
      </div>
    </div>

    <!-- 预约按钮 -->
    <div class="appointment-button">
      <el-button 
        type="primary" 
        size="large" 
        :disabled="!canBook" 
        @click="bookAppointment"
        class="book-btn"
      >
        立即预约
      </el-button>
    </div>
  </div>
</template>

<script>
</script>

<style scoped>
.appointment-container {
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
  min-height: 100vh;
}

.section-card {
  background: white;
  margin-bottom: 20px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid #edf2f7;
  transition: all 0.3s ease;
}

.section-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  padding-right: 15px;
  white-space: nowrap;
}

.section-divider {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, #e2e8f0, transparent);
}

.staff-list {
  display: flex;
  overflow-x: auto;
  padding-bottom: 10px;
}

.staff-item {
  flex: 0 0 auto;
  width: 100px;
  text-align: center;
  padding: 15px 10px;
  margin-right: 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
  background: #f8fafc;
}

.staff-item:hover {
  background: #edf2f7;
  transform: translateY(-3px);
}

.staff-item.active {
  border-color: #409EFF;
  background-color: #eff6ff;
  box-shadow: 0 4px 6px rgba(64, 158, 255, 0.1);
}

.staff-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 8px;
  border: 2px solid #e2e8f0;
}

.staff-name {
  font-weight: 600;
  margin-bottom: 4px;
  color: #2d3748;
}

.staff-position {
  font-size: 12px;
  color: #718096;
}

.duration-select {
  width: 100%;
}

.date-list {
  display: flex;
  overflow-x: auto;
  padding-bottom: 10px;
}

.date-item {
  flex: 0 0 auto;
  width: 60px;
  text-align: center;
  padding: 12px 5px;
  margin-right: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.date-item:hover {
  background: #edf2f7;
  transform: translateY(-2px);
}

.date-item.active {
  background-color: #409EFF;
  color: white;
  border-color: #409EFF;
  box-shadow: 0 4px 6px rgba(64, 158, 255, 0.2);
}

.date-week {
  font-size: 12px;
  margin-bottom: 5px;
}

.date-day {
  font-size: 18px;
  font-weight: bold;
}

.time-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.time-item {
  width: calc(25% - 12px);
  text-align: center;
  padding: 14px 5px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  font-weight: 500;
}

.time-item:hover:not(.disabled) {
  background-color: #edf2f7;
  transform: translateY(-2px);
}

.time-item.active {
  background-color: #409EFF;
  color: white;
  border-color: #409EFF;
  box-shadow: 0 4px 6px rgba(64, 158, 255, 0.2);
}

.time-item.time-range {
  background-color: #b3d9ff;
  border-color: #80bfff;
}

.time-item.disabled {
  background-color: #f1f5f9;
  color: #cbd5e0;
  cursor: not-allowed;
}

.book-btn {
  width: 100%;
  height: 50px;
  font-size: 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #409EFF 0%, #3694ff 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  transition: all 0.3s ease;
}

.book-btn:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
  transform: translateY(-2px);
}

.book-btn:active:not(:disabled) {
  transform: translateY(0);
}

.book-btn:disabled {
  background: #cbd5e0;
  box-shadow: none;
}
</style>